package com.store.app.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.store.app.R;
import com.store.app.bean.SpecialsellDeviceBean;

import java.util.List;



/**
 * Created by Administrator on 2017/5/11 0011.
 */
public class SpecialSellRVAdapter extends RecyclerView.Adapter{

    private Context mContext;
    private List<SpecialsellDeviceBean> specialsellDeviceBeanList;
    public SpecialSellRVAdapter(Context context ,List<SpecialsellDeviceBean> specialsellDeviceBeanList) {
        mContext = context;
        this.specialsellDeviceBeanList = specialsellDeviceBeanList;
    }
    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {

        View view = View.inflate(mContext, R.layout.item_device,null);
        return new ViewHolder(view);
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        ViewHolder viewHolder = (ViewHolder) holder;
        SpecialsellDeviceBean  specialsellDeviceBean  = specialsellDeviceBeanList.get(position);
        //设置中划线并加清晰
//        viewHolder.tvMarketPrice.getPaint().setFlags(Paint. STRIKE_THRU_TEXT_FLAG|Paint.ANTI_ALIAS_FLAG);
        viewHolder.bindData(specialsellDeviceBean);
    }


    @Override
    public int getItemCount() {
        return specialsellDeviceBeanList.size();
    }

    static class ViewHolder extends RecyclerView.ViewHolder{

        public ImageView iv;
        public TextView tvTitle;
        public TextView tvContent;

        public ViewHolder(View itemView) {
            super(itemView);
            iv = (ImageView) itemView.findViewById(R.id.iv);
            tvTitle = (TextView) itemView.findViewById(R.id.tv_title);
            tvContent = (TextView) itemView.findViewById(R.id.tv_content);
        }

        public void bindData(SpecialsellDeviceBean specialsellDeviceBean) {
            tvContent.setText("dfsd");
        }
    }
}
